<%--

    Copyright (C) 2009 alex <me@alex.0x08.org>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ include file="/common/taglibs.jsp" %>

<stripes:layout-render name="/templates/netbsd.jsp" title="Administer portal">
    <stripes:layout-component name="contents">


        <div class="subtitle">People</div>
        <stripes:form action="/action/AdministerPeople">
            <stripes:errors/>

            <table class="display">
                <tr>
                    <th><img src="${pageContext.request.contextPath}/img/trash.png" title="Delete"/></th>
                    <th>ID</th>
                    <th>Логин</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Почта</th>
                    <th>Роли</th>
                </tr>
                <c:forEach items="${bzManager.allPeople}" var="person" varStatus="loop">
                    <tr>
                        <td><stripes:checkbox name="deleteIds" value="${person.id}"
                                          onclick="handleCheckboxRangeSelection(this, event);"/></td>
                        <td>
                            ${person.id}
                            <stripes:hidden name="people[${loop.index}].id" value="${person.id}"/>
                        </td>
                        <td>
                            <a href="<c:url value='/profile/${person.id}'/>">${person.username}</a>
                            
                        </td>
                        <td><c:out value="${person.firstName}"/></td>
                        <td><c:out value="${person.lastName}"/></td>
                        <td><c:out  value="${person.email}"/></td>
                        <td>
                            <c:forEach var="role" items="${person.roles}">
                                <c:out value="${role.name}"/>,
                            </c:forEach>
                        </td>
                    </tr>
                    <c:set var="newIndex" value="${loop.index + 1}" scope="page"/>
                </c:forEach>
              
            </table>

            <div class="buttons">
                <stripes:submit name="save" value="Удалить выбранных"/>
            <stripes:submit name="New" value="Новый юзверь"/>
            </div>
        </stripes:form>

      
    </stripes:layout-component>
</stripes:layout-render>